package com.hf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hf.entity.Sign;
import com.hf.entity.SignParam;
import com.hf.mapper.SignMapper;
import com.hf.service.ISignService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author eight
 * @since 2021-06-06
 */
@Service
public class SignServiceImpl extends ServiceImpl<SignMapper, Sign> implements ISignService {

	@Autowired
	SignMapper signMapper;

	@Override
	public IPage<Sign> getList(SignParam s) {
		// TODO Auto-generated method stub
		Page<Sign> p = new Page<>(s.getPage(), s.getLimit());
		QueryWrapper<Sign> q = new QueryWrapper<>();
		q.orderByDesc("id");
		Page<Sign> selectPage = signMapper.selectPage(p, q);

		return selectPage;
	}

	@Override
	public Sign getSignByUserIdAndTime(Integer userId, String signOnTime) {
		// TODO Auto-generated method stub
		return signMapper.getSignByUserIdAndTime(userId, signOnTime);
	}

	@Override
	public boolean updateQianTui(Integer userId, String signOffTime) {
		// TODO Auto-generated method stub
		return signMapper.updateQianTui(userId, signOffTime);
	}

}
